package com.xy.biz.fd.manager.impl;

import com.xy.biz.fd.dao.DocumentRubbishDao;
import com.xy.biz.fd.domain.bo.DocumentRubbishBO;
import com.xy.biz.fd.domain.converter.DocumentRubbishConverter;
import com.xy.biz.fd.domain.query.DocumentRubbishQuery;
import com.xy.biz.fd.manager.DocumentRubbishManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;
import java.util.List;

/**
 * 
 * 
 * @author yzh
 * @date 2021年1月30日
 */
@Service
public class DocumentRubbishManagerImpl implements DocumentRubbishManager {

	@Autowired
	private DocumentRubbishDao documentRubbishDao;

	@Transactional
	@Override
	public int saveDocumentRubbish(DocumentRubbishBO documentRubbishBO) {
		int affectedRows = documentRubbishDao.saveDocumentRubbish(DocumentRubbishConverter.toPO(documentRubbishBO));
		return affectedRows;
	}
	
	@Override
	public int saveAllDocumentRubbish(Collection<DocumentRubbishBO> collection) {
		return documentRubbishDao.saveAllDocumentRubbish(DocumentRubbishConverter.toPO(collection));
	}
	
	@Override
	public int updateDocumentRubbish(DocumentRubbishBO documentRubbishBO) {
		return documentRubbishDao.updateDocumentRubbish(DocumentRubbishConverter.toPO(documentRubbishBO));
	}
	
	@Override
	public int deleteDocumentRubbish(java.lang.Long documentRubbishId) {
		return documentRubbishDao.deleteDocumentRubbish(documentRubbishId);
	}

	/**
	 * 根据documentRubbishId批量删除
	 *
	 * @param documentRubbishIds
	 */
	@Override
	public int deleteDocumentRubbishByIds(Collection<Long> documentRubbishIds) {
		return documentRubbishDao.deleteDocumentRubbishIds(documentRubbishIds);
	}

	@Override
	public DocumentRubbishBO getDocumentRubbish(java.lang.Long documentRubbishId) {
		return DocumentRubbishConverter.fromPO(documentRubbishDao.getDocumentRubbish(documentRubbishId));
	}
	
	@Override
	public List<DocumentRubbishBO> listDocumentRubbishById(Collection<java.lang.Long> collection) {
		return DocumentRubbishConverter.fromPO(documentRubbishDao.listDocumentRubbishById(collection));
	}
	
	@Override
	public List<DocumentRubbishBO> listDocumentRubbish(DocumentRubbishQuery query) {
		return DocumentRubbishConverter.fromPO(documentRubbishDao.listDocumentRubbish(query));
	}

	/**
	 * 根据rubbishId查找多个
	 *
	 * @param rubbishIds 查找条件
	 */
	@Override
	public List<DocumentRubbishBO> listDocumentRubbishByRubbishId(Collection<Long> rubbishIds) {
		return DocumentRubbishConverter.fromPO(documentRubbishDao.listDocumentRubbishByRubbishId(rubbishIds));
	}

	@Override
	public int countDocumentRubbish(DocumentRubbishQuery query) {
		return documentRubbishDao.countDocumentRubbish(query);
	}
	
}
